﻿using System;

class TripleRotationOfDigits
{
    static void Main()
    {
        //Telerik Academy Exam 1 @ 29 Dec 2012

        int number = int.Parse(Console.ReadLine());

        for (int i = 0; i < 3; i++)
        {
            if (number > 9)
            {
                int lastDigit = number % 10;
                string lastDig = lastDigit.ToString();

                int remainder = number / 10;
                string remain = remainder.ToString();

                string newNumber = lastDigit + remain;

                number = int.Parse(newNumber);
            }            
        }
        Console.WriteLine(number);
    }
}

